From a24516689ff0ccb40624a58724c05e8bc24fd930 Mon Sep 17 00:00:00 2001 From: Ewan Mellor Date: Fri, 23 Mar 2007 11:00:08 +0000 Subject: [PATCH] Fix xenapi_create re: Multiple VIFs for test 04_restore_withdevices_pos Signed-off-by: Tom Wilkie --- tools/python/xen/xm/xenapi_create.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/python/xen/xm/xenapi_create.py b/tools/python/xen/xm/xenapi_create.py index d4cdb4870f..dd7f607051 100644 --- a/tools/python/xen/xm/xenapi_create.py +++ b/tools/python/xen/xm/xenapi_create.py @@ -611,7 +611,10 @@ class sxp2xml: vif = document.createElement("vif") - dev = get_child_by_name(vif_sxp, "vifname", "eth0") + dev = get_child_by_name(vif_sxp, "vifname", None) + + if dev is None: + dev = self.getFreshEthDevice() vif.attributes["name"] \ = "vif" + str(dev.__hash__()) @@ -628,7 +631,8 @@ class sxp2xml: return vif + _eths = -1 - - - + def getFreshEthDevice(self): + self._eths += 1 + return "eth%i" % self._eths -- 2.30.2